It might be worth asking in a CorelDraw forum rather than here, since it looks to be more of a Corel issue than a Notes issue. I suspect you'd have the same problem if you did this in VB.
At a guess, I'd say it might possibly work better if you were very careful to always set your OLE objects to Nothing before exiting the script. I've found this often helps clean up leftover processes and reclaim lost memory when using OLE and COM with other applications, but I haven't tried Corel.
Here's a tip: to make certain you always set an object to Nothing even if the code exits abnormally (e.g. from a user pressing Crtl+Break), create a wrapper class that uses the Delete method to set the variable to Nothing when the object is deallocated.
Class OLEWrapper
OLEobj As Variant
Sub New(eObj)
Set OLEObj = eObj
End Sub
' Make obj a read-only property to prevent messing with it.
' So call me paranoid.
Public Property Get obj( )
Set obj = OLEObj
End Property
Sub Delete
Set OLEobj = Nothing
End Sub
End Class
...
Dim App As New OLEWrapper(CreateObject("CorelDraw.Application.10"))
...
Set cdrDoc = New OLEWrapper(cdrApp.obj.CreateDocumentFromTemplate("C:\SomeTemplate.cdt", True))
and so on.


. . RE: OLE Calls to CorelDRAW from Lot... (~Bill Frokimari... 17.Oct.02) 